home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Utilities Professional 1-1500
/
Utilities Professional 1-1500 (1994)(WPD)[!].iso
/
12511500
/
var1308.dms
/
var1308.adf
/
NETUTILS.LHA
/
NetUtilities
/
source
/
receive.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-05
|
786b
|
45 lines
#include <stdio.h>
#include <libraries/dos.h>
#define REC_PKT "RAM:receive.pkt"
#define REC_ERR "Couldn't open receive packet\n"
struct FileHandle *in=0;
void quit(void) {
Close(in);
exit(0);
}
void main(void) {
char text[512], buf[512];
FILE *infile;
short err=0;
in = (struct FileHandle *)Open("CON:0/0/600/100/Parnet chat receive",MODE_NEWFILE);
if (!in) quit();
onbreak(quit);
for(;;) {
chkabort();
Delay(20);
chkabort();
err=0;
if (access(REC_PKT, 4) == 0) {
if (infile = fopen(REC_PKT, "r")) {
fgets(buf, sizeof(buf), infile);
Write(in, buf, strlen(buf));
fclose(infile);
infile=0;
remove(REC_PKT);
} else err=1;
};
if (err==1) Write(in, REC_ERR, strlen(REC_ERR));
}
}